//
//  DepositInfo.swift
//
//  Created by 邱仙凯 on 2020/2/11
//  Copyright (c) . All rights reserved.
//

import Foundation
import ObjectMapper

public class ZyaDepositInfo: Mappable {
    
    // MARK: Declaration for string constants to be used to decode and also serialize.
    private struct SerializationKeys {
        static let zBankNo = "z_bank_no"
        static let zLog = "z_log"
        static let zBankNm = "z_bank_nm"
        static let zBank = "z_bank"
        static let vouId = "vou_id"
        static let auditDt = "audit_dt"
        static let zOper = "z_oper"
        static let idKey = "id_key"
        static let auditMark = "audit_mark"
        static let auditId = "audit_id"
        static let zDate = "z_date"
        static let auditNm = "audit_nm"
        static let zBankCard = "z_bank_card"
        static let zMoney = "z_money"
        static let depositFile = "deposit_file"
        
        static let depositFileUrl = "deposit_file_url"
        static let zPayerNm = "z_payer_nm"
    }
    
    // MARK: Properties
    public var zBankNo: String?
    public var zLog: String?
    public var zBankNm: String?
    public var zBank: String?
    public var vouId: String?
    public var auditDt: String?
    public var zOper: String?
    public var idKey: Int?
    public var auditMark: Int?
    public var auditId: String?
    public var zDate: String?
    public var auditNm: String?
    public var zBankCard: String?
    public var zMoney: Double?
    public var depositFile: [ZyaDepositFile]?
    
    public var depositFileUrl: String?
    public var zPayerNm: String?
    // MARK: ObjectMapper Initializers
    /// Map a JSON object to this class using ObjectMapper.
    ///
    /// - parameter map: A mapping from ObjectMapper.
    public required init?(map: Map){
        
    }
    
    /// Map a JSON object to this class using ObjectMapper.
    ///
    /// - parameter map: A mapping from ObjectMapper.
    public func mapping(map: Map) {
        zBankNo <- map[SerializationKeys.zBankNo]
        zLog <- map[SerializationKeys.zLog]
        zBankNm <- map[SerializationKeys.zBankNm]
        zBank <- map[SerializationKeys.zBank]
        vouId <- (map[SerializationKeys.vouId],StringTransform())
        auditDt <- map[SerializationKeys.auditDt]
        zOper <- map[SerializationKeys.zOper]
        idKey <- map[SerializationKeys.idKey]
        auditMark <- map[SerializationKeys.auditMark]
        auditId <- map[SerializationKeys.auditId]
        zDate <- map[SerializationKeys.zDate]
        auditNm <- map[SerializationKeys.auditNm]
        zBankCard <- (map[SerializationKeys.zBankCard],StringTransform())
        zMoney <- map[SerializationKeys.zMoney]
        depositFile <- map[SerializationKeys.depositFile]
        zPayerNm <- map[SerializationKeys.zPayerNm]
        depositFileUrl <- map[SerializationKeys.depositFileUrl]
    }
    
    /// Generates description of the object in the form of a NSDictionary.
    ///
    /// - returns: A Key value pair containing all valid values in the object.
    public func dictionaryRepresentation() -> [String: Any] {
        var dictionary: [String: Any] = [:]
        if let value = zBankNo { dictionary[SerializationKeys.zBankNo] = value }
        if let value = zLog { dictionary[SerializationKeys.zLog] = value }
        if let value = zBankNm { dictionary[SerializationKeys.zBankNm] = value }
        if let value = zBank { dictionary[SerializationKeys.zBank] = value }
        if let value = vouId { dictionary[SerializationKeys.vouId] = value }
        if let value = auditDt { dictionary[SerializationKeys.auditDt] = value }
        if let value = zOper { dictionary[SerializationKeys.zOper] = value }
        if let value = idKey { dictionary[SerializationKeys.idKey] = value }
        if let value = auditMark { dictionary[SerializationKeys.auditMark] = value }
        if let value = auditId { dictionary[SerializationKeys.auditId] = value }
        if let value = zDate { dictionary[SerializationKeys.zDate] = value }
        if let value = auditNm { dictionary[SerializationKeys.auditNm] = value }
        if let value = zBankCard { dictionary[SerializationKeys.zBankCard] = value }
        if let value = zMoney { dictionary[SerializationKeys.zMoney] = value }
        if let value = depositFile { dictionary[SerializationKeys.depositFile] = value.map { $0.dictionaryRepresentation() } }
        
        if let value = depositFileUrl { dictionary[SerializationKeys.depositFileUrl] = value }
        if let value = zPayerNm { dictionary[SerializationKeys.zPayerNm] = value }
        return dictionary
    }
    
}
